home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / dejagnu.lha / dejagnu-1.0.1 / dejagnu / example / calc / configure < prev    next >
Text File  |  1993-05-05  |  9KB  |  303 lines

  1. #!/bin/sh
  2. # Guess values for system-dependent variables and create Makefiles.
  3. # Generated automatically using autoconf.
  4. # Copyright (C) 1991, 1992, 1993 Free Software Foundation, Inc.
  5.  
  6. # This program is free software; you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation; either version 2, or (at your option)
  9. # any later version.
  10.  
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. # GNU General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU General Public License
  17. # along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. # Usage: configure [--srcdir=DIR] [--host=HOST] [--gas] [--nfp] [--no-create]
  21. #        [--prefix=PREFIX] [--exec-prefix=PREFIX] [--with-PACKAGE] [TARGET]
  22. # Ignores all args except --srcdir, --prefix, --exec-prefix, --no-create, and
  23. # --with-PACKAGE unless this script has special code to handle it.
  24.  
  25.  
  26. for arg
  27. do
  28.   # Handle --exec-prefix with a space before the argument.
  29.   if test x$next_exec_prefix = xyes; then exec_prefix=$arg; next_exec_prefix=
  30.   # Handle --host with a space before the argument.
  31.   elif test x$next_host = xyes; then next_host=
  32.   # Handle --prefix with a space before the argument.
  33.   elif test x$next_prefix = xyes; then prefix=$arg; next_prefix=
  34.   # Handle --srcdir with a space before the argument.
  35.   elif test x$next_srcdir = xyes; then srcdir=$arg; next_srcdir=
  36.   else
  37.     case $arg in
  38.      # For backward compatibility, also recognize exact --exec_prefix.
  39.      -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* | --exec=* | --exe=* | --ex=* | --e=*)
  40.     exec_prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  41.      -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- | --exec | --exe | --ex | --e)
  42.     next_exec_prefix=yes ;;
  43.  
  44.      -gas | --gas | --ga | --g) ;;
  45.  
  46.      -host=* | --host=* | --hos=* | --ho=* | --h=*) ;;
  47.      -host | --host | --hos | --ho | --h)
  48.     next_host=yes ;;
  49.  
  50.      -nfp | --nfp | --nf) ;;
  51.  
  52.      -no-create | --no-create | --no-creat | --no-crea | --no-cre | --no-cr | --no-c | --no- | --no)
  53.         no_create=1 ;;
  54.  
  55.      -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
  56.     prefix=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  57.      -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
  58.     next_prefix=yes ;;
  59.  
  60.      -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=* | --s=*)
  61.     srcdir=`echo $arg | sed 's/[-a-z_]*=//'` ;;
  62.      -srcdir | --srcdir | --srcdi | --srcd | --src | --sr | --s)
  63.     next_srcdir=yes ;;
  64.  
  65.      -with-* | --with-*)
  66.        package=`echo $arg|sed 's/-*with-//'`
  67.        # Delete all the valid chars; see if any are left.
  68.        if test -n "`echo $package|sed 's/[-a-zA-Z0-9_]*//g'`"; then
  69.          echo "configure: $package: invalid package name" >&2; exit 1
  70.        fi
  71.        eval "with_`echo $package|sed s/-/_/g`=1" ;;
  72.  
  73.      *) ;;
  74.     esac
  75.   fi
  76. done
  77.  
  78. trap 'rm -f conftest* core; exit 1' 1 3 15
  79.  
  80. rm -f conftest*
  81. compile='${CC-cc} $DEFS conftest.c -o conftest $LIBS >/dev/null 2>&1'
  82.  
  83. # A filename unique to this package, relative to the directory that
  84. # configure is in, which we can look for to find out if srcdir is correct.
  85. unique_file=calc.c
  86.  
  87. # Find the source files, if location was not specified.
  88. if test -z "$srcdir"; then
  89.   srcdirdefaulted=yes
  90.   # Try the directory containing this script, then `..'.
  91.   prog=$0
  92.   confdir=`echo $prog|sed 's%/[^/][^/]*$%%'`
  93.   test "X$confdir" = "X$prog" && confdir=.
  94.   srcdir=$confdir
  95.   if test ! -r $srcdir/$unique_file; then
  96.     srcdir=..
  97.   fi
  98. fi
  99. if test ! -r $srcdir/$unique_file; then
  100.   if test x$srcdirdefaulted = xyes; then
  101.     echo "configure: Can not find sources in \`${confdir}' or \`..'." 1>&2
  102.   else
  103.     echo "configure: Can not find sources in \`${srcdir}'." 1>&2
  104.   fi
  105.   exit 1
  106. fi
  107. # Preserve a srcdir of `.' to avoid automounter screwups with pwd.
  108. # But we can't avoid them for `..', to make subdirectories work.
  109. case $srcdir in
  110.   .|/*|~*) ;;
  111.   *) srcdir=`cd $srcdir; pwd` ;; # Make relative path absolute.
  112. esac
  113.  
  114.  
  115.  
  116. #
  117. # Look for various header files
  118. #
  119. echo checking for stdlib.h
  120. echo checking how to run the C preprocessor
  121. if test -z "$CPP"; then
  122.   CPP='${CC-cc} -E'
  123.   cat > conftest.c <<EOF
  124. #include <stdio.h>
  125. EOF
  126. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  127. if test -z "$err"; then
  128.   :
  129. else
  130.   CPP=/lib/cpp
  131. fi
  132. rm -f conftest*
  133. fi
  134.  
  135. cat > conftest.c <<EOF
  136. #include <stdlib.h>
  137. EOF
  138. err=`eval "$CPP $DEFS conftest.c 2>&1 >/dev/null"`
  139. if test -z "$err"; then
  140.   :
  141. else
  142.   DEFS="$DEFS -DNO_STDLIB_H=1"
  143. SEDDEFS="${SEDDEFS}\${SEDdA}NO_STDLIB_H\${SEDdB}NO_STDLIB_H\${SEDdC}1\${SEDdD}
  144. \${SEDuA}NO_STDLIB_H\${SEDuB}NO_STDLIB_H\${SEDuC}1\${SEDuD}
  145. \${SEDeA}NO_STDLIB_H\${SEDeB}NO_STDLIB_H\${SEDeC}1\${SEDeD}
  146. "
  147. fi
  148. rm -f conftest*
  149.  
  150.  
  151. #
  152. # Look for various functions
  153. #
  154. echo checking for strcmp
  155. cat > conftest.c <<EOF
  156. #include <stdio.h>
  157. main() { exit(0); } 
  158. t() { 
  159. #ifdef __stub_strcmp
  160. choke me
  161. #else
  162. /* Override any gcc2 internal prototype to avoid an error.  */
  163. extern char strcmp(); strcmp();
  164. #endif
  165.  }
  166. EOF
  167. if eval $compile; then
  168.   DEFS="$DEFS -DHAVE_STRCMP=1"
  169. SEDDEFS="${SEDDEFS}\${SEDdA}HAVE_STRCMP\${SEDdB}HAVE_STRCMP\${SEDdC}1\${SEDdD}
  170. \${SEDuA}HAVE_STRCMP\${SEDuB}HAVE_STRCMP\${SEDuC}1\${SEDuD}
  171. \${SEDeA}HAVE_STRCMP\${SEDeB}HAVE_STRCMP\${SEDeC}1\${SEDeD}
  172. "
  173. fi
  174. rm -f conftest*
  175. #endif
  176.  
  177.  
  178. #
  179. # Output Makefile with substitutions
  180. if test -n "$prefix"; then
  181.   test -z "$exec_prefix" && exec_prefix='${prefix}'
  182.   prsub="s%^prefix\\([     ]*\\)=\\([     ]*\\).*$%prefix\\1=\\2$prefix%"
  183. fi
  184. if test -n "$exec_prefix"; then
  185.   prsub="$prsub
  186. s%^exec_prefix\\([     ]*\\)=\\([     ]*\\).*$%\
  187. exec_prefix\\1=\\2$exec_prefix%"
  188. fi
  189.  
  190. trap 'rm -f config.status; exit 1' 1 3 15
  191. echo creating config.status
  192. rm -f config.status
  193. cat > config.status <<EOF
  194. #!/bin/sh
  195. # Generated automatically by configure.
  196. # Run this file to recreate the current configuration.
  197. # This directory was configured as follows,
  198. # on host `(hostname || uname -n) 2>/dev/null`:
  199. #
  200. # $0 $*
  201.  
  202. for arg
  203. do
  204.   case "\$arg" in
  205.     -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
  206.     exec /bin/sh $0 $* ;;
  207.     *) echo "Usage: config.status --recheck" 2>&1; exit 1 ;;
  208.   esac
  209. done
  210.  
  211. trap 'rm -f Makefile calc.h conftest*; exit 1' 1 3 15
  212. CPP='$CPP'
  213. LIBS='$LIBS'
  214. srcdir='$srcdir'
  215. prefix='$prefix'
  216. exec_prefix='$exec_prefix'
  217. prsub='$prsub'
  218. EOF
  219. cat >> config.status <<\EOF
  220.  
  221. top_srcdir=$srcdir
  222. for file in .. Makefile; do if [ "x$file" != "x.." ]; then
  223.   srcdir=$top_srcdir
  224.   # Remove last slash and all that follows it.  Not all systems have dirname.
  225.   dir=`echo $file|sed 's%/[^/][^/]*$%%'`
  226.   if test "$dir" != "$file"; then
  227.     test "$top_srcdir" != . && srcdir=$top_srcdir/$dir
  228.     test ! -d $dir && mkdir $dir
  229.   fi
  230.   echo creating $file
  231.   rm -f $file
  232.   echo "# Generated automatically from `echo $file|sed 's|.*/||'`.in by configure." > $file
  233.   sed -e "
  234. $prsub
  235. s%@CPP@%$CPP%g
  236. s%@LIBS@%$LIBS%g
  237. s%@srcdir@%$srcdir%g
  238. s%@DEFS@%-DHAVE_CONFIG_H%" $top_srcdir/${file}.in >> $file
  239. fi; done
  240.  
  241. echo creating calc.h
  242. # These sed commands are put into SEDDEFS when defining a macro.
  243. # They are broken into pieces to make the sed script easier to manage.
  244. # They are passed to sed as "A NAME B NAME C VALUE D", where NAME
  245. # is the cpp macro being defined and VALUE is the value it is being given.
  246. # Each defining turns into a single global substitution command.
  247. #
  248. # SEDd sets the value in "#define NAME VALUE" lines.
  249. SEDdA='s@^\([     ]*\)#\([     ]*define[     ][     ]*\)'
  250. SEDdB='\([     ][     ]*\)[^     ]*@\1#\2'
  251. SEDdC='\3'
  252. SEDdD='@g'
  253. # SEDu turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
  254. SEDuA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  255. SEDuB='\([     ]\)@\1#\2define\3'
  256. SEDuC=' '
  257. SEDuD='\4@g'
  258. # SEDe turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
  259. SEDeA='s@^\([     ]*\)#\([     ]*\)undef\([     ][     ]*\)'
  260. SEDeB='$@\1#\2define\3'
  261. SEDeC=' '
  262. SEDeD='@g'
  263. rm -f conftest.sed
  264. cat > conftest.sed <<CONFEOF
  265. EOF
  266. # Turn off quoting long enough to insert the sed commands.
  267. cat >> config.status <<EOF
  268. $SEDDEFS
  269. EOF
  270. cat >> config.status <<\EOF
  271. CONFEOF
  272. rm -f conftest.h
  273. # Break up the sed commands because old seds have small limits.
  274. cp $top_srcdir/calc.h.in conftest.h1
  275. while :
  276. do
  277.   lines=`grep -c . conftest.sed`
  278.   if test -z "$lines" || test "$lines" -eq 0; then break; fi
  279.   rm -f conftest.s1 conftest.s2 conftest.h2
  280.   sed 40q conftest.sed > conftest.s1 # Like head -40.
  281.   sed 1,40d conftest.sed > conftest.s2 # Like tail +41.
  282.   sed -f conftest.s1 < conftest.h1 > conftest.h2
  283.   rm -f conftest.s1 conftest.h1 conftest.sed
  284.   mv conftest.h2 conftest.h1
  285.   mv conftest.s2 conftest.sed
  286. done
  287. rm -f conftest.sed conftest.h
  288. echo "/* calc.h.  Generated automatically by configure.  */" > conftest.h
  289. cat conftest.h1 >> conftest.h
  290. rm -f conftest.h1
  291. if cmp -s calc.h conftest.h 2>/dev/null; then
  292.   # The file exists and we would not be changing it.
  293.   rm -f conftest.h
  294. else
  295.   rm -f calc.h
  296.   mv conftest.h calc.h
  297. fi
  298.  
  299. EOF
  300. chmod +x config.status
  301. test -n "$no_create" || ./config.status
  302.  
  303.